https://glot.io/snippets/ghqv5zc028/raw/main.lua